export default function access(initialState: { currentUser?: API.CurrentUser | undefined }) {
  const { currentUser } = initialState || {};

  return {
    canAdmin: currentUser && currentUser.access === 'admin',
    normalRouteFilter: (route: any) => {
      return currentUser && currentUser.permissions.includes(route?.name);
    },
    normalButtonFilter: (buttonName: string): boolean | undefined => {
      return currentUser && currentUser.permissions.includes(buttonName);
    },
  };
}
